<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>催收记录</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<script type="text/javascript">
    var grid = null;
    $(function () {
        initGrid();//grid
        $("#searchBar").ligerForm();
        $("#searchBtn").click(function (event) {
            var form = new liger.get("searchBar");
            var data = form.getData();
            for (name in data) {
                grid.setParm(name, data[name]);
            }
            grid.reload();
        });

    });

    function clearBtn() {
        $("#resetBtn").click();
    }

    //初始化列表
    function initGrid() {
        var params = {};
        $("#grid").ligerGrid({
            url: '<%=path%>/clt/auth/record/initRskCltAuthRcdList.do',
            method: 'get',
            parms: params,
            columns: [
                {display: '客户名称', name: 'cstNm', width: 100, align: 'center', enabledSort: true},
                {display: '催收时间', name: 'collectTm', width: 120, align: 'center', enabledSort: true, render: renderDate},
                {display: '催收方式', name: 'collectWayCdNm', width: 120, align: 'center', enabledSort: true},
                {display: '催收机构', name: 'collectUsrNm', width: 200, align: 'center', enabledSort: true},
                {display: '欠款原因', name: 'ovdReasonCdNm', width: 140, align: 'center', enabledSort: true},
                {display: '催收详情', name: 'collectRem', width: 220, align: 'center', enabledSort: true},
                {display: '联系人', name: 'lkMan', width: 100, align: 'center', enabledSort: true,},
                {display: '联系电话', name: 'lkPhone', width: 100, align: 'center', enabledSort: true},
                {
                    display: '操作', name: 'flowId', width: 100, align: 'center', enabledSort: true,
                    render: function (rowdata, rowindex, value, column) {
                        var h = '';
                        h += '<a href="javascript:showDetail(';
                        h += "'" + rowdata.id + "'";
                        h += ')">查看</a>';
                        return h;
                    }
                }
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            allowUnSelectRow: true,
            alternatingRow: false,
        });
        grid = liger.get("grid");
        grid.setHeight(500);

    }


    //格式化为人民币格式
    function renderAmt(rowdata, rowindex, value) {
        var h = "￥" + FormatMoney(value);
        return h;
    }

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value && value != '') {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    //查看数据
    function showDetail(id) {
        var onCancel = function (item, Dialog) {
            Dialog.hide();
        };
        $.ligerDialog.open({
            width: 850,
            height: 500,
            title: '催收记录详情',
            url: '<%=path%>/clt/auth/record/toRskCltAuthRcdDetailPage.do?id=' + id,
            buttons: [
                {
                    text: "关闭", onclick: onCancel, type: 'cancel'
                }
            ]
        });
    }


</script>

<body class="iframeBody">
<div class="Wrapper">
    <div id="pageInTab" class="pageInTab">
        <div class="searchArea">
            <form id="searchBar">
                <div class="fieldset1 clearFix">
                    <div class="fieldBox col_33" id="searchCstNmId">
                        <div class="label">承租人</div>
                        <div class="field">
                            <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                        </div>
                    </div>
                    <div class="fieldBox">
                        <div class="label">催收时间</div>
                        <div class="field">
                            <input ligerui="width: 88" name="startCollectTm" id="startCollectTm" type="text" class="ui-datepicker" value="">
                            -
                            <input ligerui="width: 88" name="endCollectTm" id="endCollectTm" type="text" class="ui-datepicker" value="">
                        </div>
                    </div>
                    <div class="clearFix"></div>
                    <div class="btnsBox">
                        <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                        <span id="clearBtn" onclick="clearBtn();" class="sq-button sq-button-round">清空</span>
                        <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                    </div>
                </div>
            </form>
        </div>
        <div id="grid" class="sq-grid"></div>
    </div>
</div>
</body>
</html>